using System.Collections.Generic;
using System.Linq;
using Core;
using IglooCoder.Commons.WcfNhibernate;
using NHibernate;
using NHibernate.Linq;

namespace Infrastucture
{
    public class UserRepository : BaseNHibernateRepository<User>
    {
        public UserRepository(ISessionStorage sessionStorage) : base(sessionStorage)
        {
        }

        public IList<User> GetUsers()
        {
            //return Session.CreateCriteria(typeof(Core.Users)).List<Core.Users>();
            var userList = new List<User>();
            using (ITransaction tx = Session.BeginTransaction())
            {
                userList = Session.Linq<User>().ToList();
                tx.Commit();
            }
            return userList;
        }
    }
}